package cn.bj.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.bj.beans.Yxfw_candy;
import cn.bj.dao.Yxfw_candyMapper;

@Service
public class CandyService {
	@Autowired
	Yxfw_candyMapper yxfw_candyMapper;

	// 查询所有
	public List<Yxfw_candy> getAllCandys() {
		return yxfw_candyMapper.selectByExample(null);
	}

	// 增加
	public int insrtCandy(Yxfw_candy candy) {
		return yxfw_candyMapper.insert(candy);
	}

	// 删除
	public int deleteCandy(Integer id) {
		return yxfw_candyMapper.deleteByPrimaryKey(id);
	}

	// 查询单个
	public Yxfw_candy selectById(Integer id) {
		return yxfw_candyMapper.selectByPrimaryKey(id);
	}

	// 更改
	public int updateCandy(Yxfw_candy candy) {
		return yxfw_candyMapper.updateByPrimaryKey(candy);
	}

}
